package com.zero.order.web;

import com.zero.order.entity.OrderEntity;
import com.zero.order.service.OrderService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author zero
 * @ClassName OrderController
 * @Description
 * @Date 2025/5/15 13:37
 */
@RestController
@RequestMapping ("order")
public class OrderController {
    private final OrderService orderService;

    public OrderController(OrderService orderService) {
        this.orderService = orderService;
    }

    @PostMapping("create")
    public Long create(OrderEntity order) {
        return orderService.create(order);
    }

    @PostMapping ("cancel")
    public void cancel(Long orderId) {
        orderService.cancel(orderId);
    }

    @GetMapping("query")
    public OrderEntity query(Long orderId) {
        return orderService.query(orderId);
    }
     @RequestMapping ("loadBalance")
     public String loadBalance() {
        return orderService.loadBalance();
    }
}
